//
//  FPTimeTools.m
//  ForestPack
//
//  Created by jimmy on 2018/7/6.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "FPTimeTools.h"

@implementation FPTimeTools

///13位时间戳转换为年月日24小时制
+(NSString *)changeTime:(NSString *)timeString
{
    // timeStampString 是服务器返回的13位时间戳
    NSString *timeStampString  = timeString;
    
    // iOS 生成的时间戳是10位
    NSTimeInterval interval    =[timeStampString doubleValue] / 1000.0;
    NSDate *date  = [NSDate dateWithTimeIntervalSince1970:interval];
    
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateString       = [formatter stringFromDate: date];
    NSLog(@"服务器返回的时间戳对应的时间是:%@",dateString);
    
    return dateString;
}

@end
